package com.suray.wcs.web.system.request;

import com.suray.basic.wcs.path.enums.Direction;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.List;

@Getter
@Setter
public class AddSingleRuleRequest {

    private Integer gridxStart;

    private Integer gridxEnd;

    private Integer gridyStart;

    private Integer gridyEnd;

    private List<Integer> gridzList;

    private String direction;

    public boolean checkParams() {
        if (gridxStart == null || gridxStart <= 0) {
            return true;
        }
        if (gridxEnd == null || gridxEnd <= 0) {
            return true;
        }
        if (gridyStart == null || gridyStart <= 0) {
            return true;
        }
        if (gridyEnd == null || gridyEnd <= 0) {
            return true;
        }
        if (gridzList == null || gridzList.size() < 1 || gridzList.stream().filter(x -> x < 1).count() > 0) {
            return true;
        }
        if (StringUtils.isEmpty(direction) || Direction.getByCode(direction) == null) {
            return true;
        }
        return false;
    }
}
